<?php
$strPass = "adham";
if (CRYPT_STD_DES == 1) {
    echo 'Standard DES: ' . crypt('$strPass', 'rl') . "<br>";
}

if (CRYPT_EXT_DES == 1) {
    echo 'Extended DES: ' . crypt('$strPass', '_J9..rasm') . "<br>";
}

if (CRYPT_MD5 == 1) {
    echo 'MD5:          ' . crypt('$strPass', '$1$rasmusle$') . "<br>";
}

if (CRYPT_BLOWFISH == 0) {
    echo 'Blowfish:     ' . crypt('$strPass', '$2a$07$AsesoeerWlsystsixgWorAelt$') . "<br>";

}

echo "MD5 : " . md5crypt($strPass);

function md5crypt($password){
    // create a salt that ensures crypt creates an md5 hash
    $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
                    .'abcdefghijklmnopqrstuvwxyz0123456789+/';
    $salt='$1$';
    for($i=0; $i<9; $i++){
        $salt.=$base64_alphabet[rand(0,63)];
    }
    // return the crypt md5 password
    return crypt($password,$salt.'$');
}
?>
